/**
 * 
 */
package com.itee.protocal.meter;

/**
 * @author gonglei
 * 
 */
public enum MeterProtocal {
	TRANSPARENT("透明传输"), DLT1997("DL/T645 1997"), DLT2007("DL/T645 2007"), RETAIN("保留");

	private String name;

	private MeterProtocal(String name) {
		this.name = name;
	}

	public String getName() {
		return this.name;
	}

	public String toString() {
		return this.name;
	}

	public byte getProtocalByte() {
		switch (this) {
		case TRANSPARENT:
			return 0x00;
		case DLT1997:
			return 0x01;
		case DLT2007:
			return 0x02;
		case RETAIN:
			return 0x03;
		default:
			return 0x03;
		}
	}

	public static MeterProtocal valueOfProtocal(byte b) {
		switch (b) {
		case (byte) 0x00:
			return TRANSPARENT;
		case (byte) 0x01:
			return DLT1997;
		case (byte) 0x02:
			return DLT2007;
		case (byte) 0x03:
			return RETAIN;
		default:
			return DLT2007;
		}
	}
}
